from pyquery import PyQuery as pq
import requests
import os
import json

cars=dict()
doc = pq(requests.get('https://www.guazi.com/bj/buy/').text)
lis = doc('div.screen div.clearfix a')
for a in lis.items():
    text=a.text()
    h='https://www.guazi.com/bj/buy/'+a.attr.href
    cars[text]=h
data = json.dumps(cars,ensure_ascii=False)
f = open("books\\json_file2.txt","w",encoding='utf-8')
f.write(data)
f.close()

f = open("books\\json_file2.txt","r",encoding='utf-8')
content = f.read()
data = json.loads(content)
for i in data:
    r = requests.get(data[i])
    print(r.text)
f.close
